package LeetCode.month01.day28;

public class No2269 {
    public static void main(String[] args) {
        System.out.println(divisorSubstrings(240,2));
    }
    public static int divisorSubstrings(int num, int k) {
        char[] c = (num+"").toCharArray();
        int n = c.length;
        int count = 0;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i <n; i++) {
            sb.append(c[i]);
            if(sb.length()<k) continue;
            if(Integer.parseInt(sb.toString())!=0&&num%Integer.parseInt(sb.toString())==0) count++;
            sb.deleteCharAt(0);
        }
        return count;
    }
}
